<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
<%@ page import="net.sapfree.core.util.DateUtility"%>

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";

String taskuuid = request.getParameter("taskuuid")==null?"":(String)request.getParameter("taskuuid");
%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">    
<meta http-equiv="keywords" content="login,regist first">
<meta http-equiv="description" content="This is login page">

<title>我的飞客</title>
<link href="<%=path%>/include/styleBase/css/fontStyle.css" rel="stylesheet"></link>
<link href="<%=path%>/include/styleBase/css/formStyle.css" rel="stylesheet"></link>
<link href="<%=path%>/include/DatePicker/skin/formStyle.css" rel="stylesheet"></link>

<script type="text/javascript" src="<%=path%>/include/js/jquery.js"></script>
<script type="text/javascript" src="<%=path%>/include/js/style.js"></script>
<script type="text/javascript" src="<%=path%>/include/DatePicker/WdatePicker.js"></script>
 
<script type="text/javascript" src="<%=path%>/include/KindEditor/kindeditor.js"></script>


<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
-->
</style>

<style type="text/css">
.photo
{
    margin-left:auto;
    margin-right:auto;
    margin-top:5px;
    width:160px;
    height:160px;
    overflow:hidden;
    background-color:#f8fdff;
    border:4px solid #f3f3f3;
    text-align:center;
    vertical-align:bottom;
    line-height:62px; 
    display:block;
}

.photoTitle
{
    margin-left:auto;
    margin-right:auto;
    display:table;
    padding-top:0px;
    
    *padding-left:15px;
    _padding-left:15px;
}
</style>
<script type="text/javascript" src="<%=path%>/include/FileUpload/fileUpload.js"></script>
<script type="text/javascript">
function delFile(preSavePath){
	savePath = document.getElementById("myphoto").savePath;
    $.ajax({
		type: "POST", url: "<%=path%>/servlet/FileUploadManagerServlet?method=delImage&filePath="+savePath,
		data:$("#form1").serialize(),
		error:function(){alert("与服务器失去联系，请刷新本页面后再重试！");},
		success: function(msg){
			//页面去除img的属性
			$("#myphoto").attr("src","");
			$("#myphoto").attr("savePath","");
		}
	});
 }


//上传组件参数初始化
var setting={
	id:"FileUpload",
	swfPath:"<%=path%>/include/FileUpload/FileUploadForHr.swf",
	serverPath:"<%=path%>/servlet/FileUploadManagerServlet?method=savePhoto",
	imgPath:"<%=path%>/include/FileUpload/uploadPhoto.jpg",
	width:160,
	height:20,
 	fileSize:"20",
	noFileType:"*.exe",
 	checkAndUploadExtend:checkAndUploadExtend,
 	uploadOnProgressExtend:uploadOnProgressExtend,
 	uploadCompleteExtend:uploadCompleteExtend
};


/*上传文件有效性判断*/
function checkAndUploadExtend(id,serverJson){

	//记录前一次上传的图片的url
	prePhotoSavePath = document.getElementById("myphoto").savePath;
    
	//如果你想获取当前上传组件参数的话
	//var parameters=FU.getSettingById[id];
	if(serverJson.checkType=="all"){
		//各种校验通过,如果你想在文件正式上传前做点什么的话，你就在这做吧！
		//alert("serverJson:"+serverJson);
		
		//$("#fileInfo").html(serverJson.fileName);
		//$("#json1").html(FU.jsonToStr(serverJson));
	}else if(serverJson.checkType=="suffix"){
		//文件后缀名有误
		alert("文件后缀名有误1");
	}else if(serverJson.checkType=="noSuffix"){
		//不允许的后缀名出错
		alert("不允许的后缀名有误1");
	}else if(serverJson.checkType=="size"){
		//文件大小有误
		alert("文件大小超过限制,请上传20以内的附件.");
	}
}

/*文件上传进度控制*/
function uploadOnProgressExtend(id,serverJson){
	var percentFormat=Math.floor(serverJson.percent*100);
	//$("#json2").html(FU.jsonToStr(serverJson));
	//$("#perspan").html(percentFormat+"%");
}

/*文件上传成功后，将服务器返回值返回到页面*/
function uploadCompleteExtend(id,serverJson){
	//如果你想在文件上传结束后做点什么的话，你就在这做吧！
	var imageObj = eval("("+serverJson+")");
//	alert("返回文件名："+imageObj.fileName);//返回文件名
//	alert("返回照片相对路径："+imageObj.imgPath);//返回照片相对路径
//	alert("返回压缩后照片的相对路径："+imageObj.smallImgPath);//返回压缩后照片的相对路径
	
	//页面读取照片的url
	var imagurl = '<%=path%>/servlet/FileUploadManagerServlet?method=showImage&imgPath='+imageObj.imgPath;
	
	document.getElementById("WORD_WKW_PICTURE").value=imageObj.imgPath;
	document.getElementById("WORD_WKW_SMALLPICTURE").value=imageObj.smallImgPath;
	/*
	$.ajax({
		type: "POST", url: '<%=path%>/wiki?method=saveWordPicture&taskuuid=&imgpath='+imageObj.imgPath+'&smallimgpath='+imageObj.smallImgPath,
		error:function(){alert("与服务器失去联系，请刷新本页面后再重试！");},
		success: function(msg){}
		});
		*/
		
	//设置img的src属性
	$("#myphoto").attr("src",imagurl);
	$("#myphoto").attr("savePath",imageObj.imgPath);
}

</script>

<script>
function saveWord(){
	document.frm.action="<%=path%>/wiki?method=createWord";
	document.frm.submit();
}
</script>

</head>
<body style="text-align:center;">


<form name="frm" method="post">

<input style="display:none;" type="text" id="CONTENT" name="CONTENT" value=""/>                  
<input style="display:none;" type="text" id="HTMLCONTENT" name="HTMLCONTENT" value=""/>
<input style="display:none;" type="text" id="WORD_WKW_TASKUUID" name="WORD_WKW_TASKUUID" value="<%=taskuuid%>"/>


<table border="0" cellpadding="0" cellspacing="0" width="100%">
	<tr>
    	<td align="center">
        	<table border="0" cellpadding="0" width="1000">
          	<tr>
          	  <td class="tdTitle" nowrap height="30" align="right">&nbsp;</td>
          	  <td colspan="2">&nbsp;</td>
        	  </tr>
          	<tr>
              <td class="tdTitle" nowrap height="30" width="120" align="right">词条名称：              </td>
              <td colspan="2">
              <input class="inputTxt" type="text" id="WORD_WKW_WORDNAME" name="WORD_WKW_WORDNAME" value="" style="width:300px;"/>              </td>
          	</tr>
            <tr>
              <td class="tdTitle" nowrap height="30" width="120" align="right">概要说明：              </td>
              <td colspan="2">
           	  <textarea cols="80" rows="5" id="WORD_WKW_MEMO" name="WORD_WKW_MEMO"></textarea>              </td>
          	</tr>
            <tr>
              <td class="tdTitle" nowrap height="30" width="120" align="right">附图：              </td>
              <td width="214">
              <div id="carImageDiv" class="photo">
                    <span id="perspan"></span>
                    <input id="zhaopianurl" type="hidden" value="">
                    <input id="WORD_WKW_PICTURE" name="WORD_WKW_PICTURE" type="hidden" value="">
                    <input id="WORD_WKW_SMALLPICTURE" name="WORD_WKW_SMALLPICTURE" type="hidden" value="">
                    <img id="myphoto" name="myphoto" savePath="" alt="" width="160" height="160" src="" style="border: 0px;" />
                    <script language="javascript">
					<!--
					function setzhaopianurl(){
						var obj = document.getElementById("zhaopianurl");
						var pobj = document.getElementById("myphoto");
						if(obj.value==""){
							pobj.src="<%=path%>/upload/user/nobody.gif";
						}else{
							pobj.src="<%=path%>/servlet/FileUploadManagerServlet?method=showImage&imgPath="+obj.value;
						}
					}
					setzhaopianurl();
					-->
					</script> 
                </div>
                <script>
				//调用上传组件
				FU.iniFlashPlayer(setting);
				</script>              </td>
          	  <td width="658" class="greyNormal14">请上传小于1M的图片，图片格式为jpg、jpeg、gif。</td>
            </tr>
            </table>
        </td>
    </tr>
</table>



<table border="0" cellpadding="0" cellspacing="0" width="310" style="margin-top:20px;" align="center">
	<tr>
    	<td width="70">
        <table border="0" cellpadding="0" cellspacing="0" width="60" height="25">
            <tr>
              <td width="60" bgcolor="f6891f" align="center" style="cursor:hand;"><span style="color:#FFFFFF; font-weight:bold; font-size:14px;" onClick="saveWord();">保存</span></td>
            </tr>
        </table>
        </td>
        <!--td width="70">
        <table border="0" cellpadding="0" cellspacing="0" width="60" height="25">
            <tr>
              <td width="60" bgcolor="f6891f" align="center" style="cursor:hand;"><span style="color:#FFFFFF; font-weight:bold; font-size:14px;" onClick="preViewBlog();">预览</span></td>
            </tr>
        </table>
        </td>
        <td width="170">
        <table border="0" cellpadding="0" cellspacing="0" width="120" height="25">
            <tr>
              <td width="120" bgcolor="f6891f" align="center" style="cursor:hand;"><span style="color:#FFFFFF; font-weight:bold; font-size:14px;">保存到草稿箱</span></td>
            </tr>
        </table>
        </td-->
    </tr>
</table>

</form>
</body>
</html>

